package com.xiaomengkuan.product.controller;

import com.xiaomengkuan.common.util.R;
import com.xiaomengkuan.product.service.TagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author Faraj Mujey
 * -- Creation Time: 2021-02-25 6:45 下午, File Encoding: utf8 --
 */
@RequestMapping("product/admin")
@RestController
@Api(tags = "标签后台管理")
public class AdminTagController {
    @Resource
    private TagService tagService;

    @PostMapping(value = "getAllTag")
    @ApiOperation(value = "获取所有的标签")
    public R getAllTag(@RequestBody Map<String, Object> requestBody) {
        return tagService.getAllTag(requestBody);
    }

    @PostMapping("tag/create")
    @ApiOperation(value = "创建标签")
    public R createTag(@RequestBody Map<String, Object> requestBody){
        return tagService.createTag(requestBody);
    }

    @PostMapping("tag/modify")
    @ApiOperation(value = "修改标签")
    public R modifyTag(@RequestBody Map<String, Object> requestBody){
        return tagService.modifyTag(requestBody);
    }

    @DeleteMapping("tag/{id}")
    @ApiOperation(value = "删除标签")
    public R removeTag(@PathVariable("id") String id) {
        return tagService.removeTag(id);
    }

}
